package foo.dao;

import java.util.List;

import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.stereotype.Repository;

import foo.base.BaseJdbcDAO;
import foo.dbvo.SysTypeDbvo;

@Repository
public class SysTypeDAO extends BaseJdbcDAO {
	public List<SysTypeDbvo> findByTypeGroup(String typeGroup) {
		ParameterizedBeanPropertyRowMapper<SysTypeDbvo> pbprm = ParameterizedBeanPropertyRowMapper
				.newInstance(SysTypeDbvo.class);
		StringBuilder sb = new StringBuilder(" select type_id, dscr ");
		sb.append(" from SYS_TYPE t ");
		
		sb.append(" where type_group =? ");
		
		String sql = sb.toString();
		logger.debug("QUERY SQL:" + sql);
		List<SysTypeDbvo> list = jdbcTemplate.query(sql,
				new Object[] { typeGroup }, pbprm);
		return list;
	}
}
